package com.yzt.minemodule.adapter;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.user.PersonalDetailAlbum;
import com.yzt.minemodule.R;
import com.yzt.plugin_imageloader.ImageLoadUtil;

/**
 * author : bob
 * date   : 2022/12/8
 * desc   : 相册列表
 */
public class PhotoListAdapter extends BaseQuickAdapter<PersonalDetailAlbum, BaseViewHolder> {

    public PhotoListAdapter() {
        super(R.layout.item_photo_list);
    }

    @Override
    protected void convert(BaseViewHolder holder, PersonalDetailAlbum item) {
        ImageView photographLayout = holder.getView(R.id.photograph_layout);
        FrameLayout photoLayout = holder.getView(R.id.photo_layout);
        if (item.getAuditStatus() == PersonalDetailAlbum.ALBUM_UP) {
            photographLayout.setVisibility(View.VISIBLE);
            photoLayout.setVisibility(View.GONE);
            holder.setGone(R.id.img_del, true);
        } else {
            photographLayout.setVisibility(View.GONE);
            photoLayout.setVisibility(View.VISIBLE);
            ImageLoadUtil.loadAvatar(getContext(), item.getPicUrl(), holder.getView(R.id.photo_riv));

            TextView mExamineTv = holder.getView(R.id.examine_status_tv);
            mExamineTv.setVisibility(item.getAuditStatus() == PersonalDetailAlbum.ALBUM_EXAMINE ? View.VISIBLE : View.GONE);
            holder.setGone(R.id.img_del, false);
        }
    }
}

